/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pt.mleiria.app.web.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import pt.mleiria.vo.HangManVO;
import pt.mleiria.vo.SessionObjects;

/**
 *
 * @author manuel
 */
@ManagedBean(name = "hangManBean")
@SessionScoped
public class HangManBean extends MasterBean {

    private HangManVO hangMan;
    private boolean nextStep;
    private boolean hang;
    private boolean playerSetup;
    private String image;
    private String[] images = new String[]{"hangMan0.png", "hangMan1.png", "hangMan2.png", "hangMan3.png", "hangMan4.png", "hangMan5.png", "hangMan6.png"};
    private String letter;
    
    public HangManBean() {
        playerSetup = true;
        hangMan = new HangManVO();
        if(null == getFromSession(SessionObjects.HANG_MAN)){
            setToSession(SessionObjects.HANG_MAN, hangMan);
        }else{
            hangMan = (HangManVO)getFromSession(SessionObjects.HANG_MAN);
        }
        
    }
    public String getLetter(){
        getLogger(HangManBean.class).info("letter:"+ letter);
        return "";
    }
    
    public String next() {
        nextStep = true;
        playerSetup = false;
        
        return "";
    }

    public boolean isNextStep() {
        return nextStep;
    }

    public boolean isHang() {
        return hang;
    }

    public boolean isPlayerSetup() {
        return playerSetup;
    }

    public String startGame() {
        nextStep = false;
        hang = true;
        playerSetup = false;
        this.image = images[0];
        return "";
    }

    /**
     * @return the image
     */
    public String getImage() {
        return image;
    }

    /**
     * @param image the image to set
     */
    public void setImage(String image) {
        this.image = image;
    }

    public HangManVO getHangMan() {
        return hangMan;
    }

    public void setHangMan(HangManVO hangMan) {
        this.hangMan = hangMan;
    }
    
}
